<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class Product
 * 
 * @property int $id
 * @property int $category_id
 * @property string $name
 * @property string $buying_point
 * @property int $unit_id
 * @property int $brand_id
 * @property string $specifications
 * @property int $min_order
 * @property float $shop_price
 * @property float $market_price
 * @property float $cost_price
 * @property int $inventory_num
 * @property int $warning_num
 * @property string $product_code
 * @property string $bar_code
 * @property string $inventory_code
 * @property string $image_url
 * @property int $status
 * @property Carbon $created_at
 * @property Carbon $updated_at
 *
 * @package App\Models
 */
class Product extends Model
{
	protected $table = 't_product';

	protected $casts = [
		'category_id' => 'int',
		'unit_id' => 'int',
		'brand_id' => 'int',
		'min_order' => 'int',
		'shop_price' => 'float',
		'market_price' => 'float',
		'cost_price' => 'float',
		'inventory_num' => 'int',
		'warning_num' => 'int',
		'status' => 'int'
	];

	protected $fillable = [
		'category_id',
		'name',
		'buying_point',
		'unit_id',
		'brand_id',
		'specifications',
		'min_order',
		'shop_price',
		'market_price',
		'cost_price',
		'inventory_num',
		'warning_num',
		'product_code',
		'bar_code',
		'inventory_code',
		'image_url',
		'status'
	];

    public function category()
    {
        return $this->hasOne(Category::class,'id','category_id');
    }

    public function brand(){

    }


    public function unit(){

    }
}
